home *** CD-ROM | disk | FTP | other *** search
- ===========================================================================
- BBS: The Abacus * HST/DS * Potterville, MI
- Date: 06-06-93 (11:27) Number: 220
- From: DANIEL LYNES Refer#: NONE
- To: MATTHEW O'CONNOR Recvd: NO
- Subj: Mod File Routines 4/4 Conf: (36) C Language
- ---------------------------------------------------------------------------
- /*******************/
- /* decode MOD file */
- /*******************/
-
- /* first bits of header */
-
- _read(handle,(*mod2).Name,20);
- mod2->Name[20] = '\0'; /* Make sure name is terminated */
- printf("%s\n",mod2->Name);
-
- /* ---------------- */
- /* Load instraments */
- /* ---------------- */
-
- for ( c = 0 ; c < 31 ; c ++)
- {
- Read_Inst(&mod2->Inst[c],handle);
- /*Print_Inst(&mod2->Inst[c]);
- printf("------------------------\n"); */
- };
-
- /* -------------- */
- /* Load song info */
- /* -------------- */
-
- _read(handle,ta,2); /* buffer it in */
-
- mod2->Len = ta[0]; /* length of song */
-
- _read(handle,&mod2->Pat,MAXPAT);
-
- _read(handle,&mod2->Mark,4);
-
- printf("%.4s \n",mod2->Mark); /* should be M.K. or FLT4 or FLT8 */
-
-
- for (c=0; c<MAXTRACK;c++)
- {
- Read_Track(mod2->Track[c],handle);
- Print_Track(mod2->Track[c]);
- };
-
- Read_Samp(&mod2->Inst[1],ptr);
- printf("Load Samp\n");
-
- ptr = (char *) fptr;
-
- _close(handle);
- return(0);
- }
-
-
- int main (void) {
- struct S_Mod mod;
- int t;
-
- for (t=0;t<MAXTRACK;t++)
- {
- mod.Track[t] = (struct S_Track*)malloc(sizeof(struct S_Track));
- if (mod.Track[t] == NULL)
- {
- printf("Ran out of Ram!\n");
- exit(1);
- };
- };
-
- char songname[40]="b.mod\0";
-
- printf("-------\n");
- Load_Song(songname,&mod);
- return(0);
- }
- /**************************************************************/
- /* Mod2.H */
- /**************************************************************/
- /* This is the header file for Mod_File.c All copy */
- /* right information is in that document. This file is an */
- /* extenstion of that program. */
- /**************************************************************/
- /* Written by Kirk Smith (1:105/290.7) */
- /**************************************************************/
-
-
- struct S_Note { /* Structure of Mod Note */
- public:
- byte Num; /* Instrament Number */
- word Period; /* Note period */
- word Effect; /* Effect command */
- };
-
- struct S_Channel { /* Structure of Mod Chan */
- public:
- struct S_Note Chan[MAXCHAN]; /* 0,2 Left 1,3 Right */
- };
-
- struct S_Track { /* Structure of Mod Track */
- public:
- struct S_Channel Note[MAXNOTES]; /* 64 notes per track */
- };
-
- struct S_Song { /* Structure of Mod Song */
- public:
- struct S_Track *Track[MAXTRACK]; /* MAX tracks per song */ };
-
- struct S_Inst { /* Structure of Mod Inst */
- public:
- char Name[23]; /* Instrament Name */
- word Len; /* Inst Sample Name */
- byte F_Tune; /* Fine Tunning Sample */
- byte Vol; /* Inst Volume Level */
- word R_Start; /* Repeat Start */
- word R_Len; /* Repeat Lenght */
- char *Samp; /* Pointer to Sample */
- };
-
-
- struct S_Mod { /* Structure of whole Mod */
- public:
- char Name[21]; /* Song Name */
- struct S_Inst Inst[MAXINST]; /* Instraments of song */
- byte Len; /* Lenght of song file */
- byte Ciaa; /* CIAA Speed (not used) */
- char Mark[4]; /* Mod Mark M.K./FLT4/FLT8*/
- byte Pat[MAXPAT]; /* Pattern to play tracks */
- struct S_Track *Track[MAXTRACK]; /* Tracks of the song.
- NOTE: S_Song wasn't used */
- };
-
- N.B. There was a young gentleman on NANet that had originally
- posted this. This young man was the above signed. If you would
- like to find out more about it, I would suggest contacting Kirk
- Smith on North AmeriNet (from Canada Remote Systems).
-
- * SLMR 2.1a * Beware of the powermonging InterLink Moderators.
-
- --- SLMAIL v3.0 (#0272)
- * Origin: Thunder Bay, Ontario, Canada (1:229/516)
- SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
- SEEN-BY: 153/752 154/40 77 157/110 159/100 125 430 575 950 203/23 209/209
- SEEN-BY: 261/1023 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20
-